package com.ruiysoft.crm.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ruiysoft.crm.mapper.BizPolicyMapper;
import com.ruiysoft.crm.model.entity.BizPolicy;
import com.ruiysoft.crm.model.vo.PolicyVo;
import com.ruiysoft.crm.service.BizPolicyService;
import com.ruiysoft.crm.util.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author fanyl5
 */
@Service
public class BizPolicyServiceImpl extends ServiceImpl<BizPolicyMapper, BizPolicy> implements BizPolicyService {

    private final BizPolicyMapper bizPolicyMapper;

    public BizPolicyServiceImpl(BizPolicyMapper bizPolicyMapper) {
        this.bizPolicyMapper = bizPolicyMapper;
    }

    /**
     * 保单列表查询
     *
     * @param query 查询参数
     * @return 保单列表
     */
    @Override
    public IPage queryPolicyList(Query<BizPolicy> query) {
        Map<String, Object> params = query.getCondition();
        return bizPolicyMapper.queryPolicyList(query, params);
    }


    /**
     * 根据id查询保单
     *
     * @param id 保单id
     * @return 保单数据
     */
    @Override
    public PolicyVo getPolicyById(Integer id) {
        return bizPolicyMapper.getPolicyById(id);
    }

    @Override
    public List<PolicyVo> queryPolicyListByUserId(String userId) {
        return bizPolicyMapper.queryPolicyListByUserId(userId);
    }
}




